home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10469 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  783 b 

  1. Path: unixg.ubc.ca!news
  2. From: jamesdf@unixg.ubc.ca (James Fairweather)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: friend functions and access to private variables...
  5. Date: Fri, 08 Mar 1996 05:36:48 GMT
  6. Organization: Resnet
  7. Message-ID: <4hogra$gnn@nntp.ucs.ubc.ca>
  8. References: <4ho95g$hjq@ccshst05.cs.uoguelph.ca>
  9. NNTP-Posting-Host: srtb0411a01.resnet.ubc.ca
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. >I'm dealing with two classes, where a member function of class A is declared as
  13. >a friend function of class B.
  14.  
  15. >Unfortunately this does not allow the friend function access to private variables in
  16. >class B...what gives? Is it not legal to make such a declaration?
  17.  
  18. Heh, you have it backwards.  To allow class A to access B's private
  19. members, put friend class _A_; in B's header.
  20.  
  21.     James
  22.  
  23.